package cn.source.system.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import cn.source.common.annotation.Log;
import cn.source.common.core.controller.BaseController;
import cn.source.common.core.domain.AjaxResult;
import cn.source.common.enums.BusinessType;
import cn.source.system.domain.TravelNavgait;
import cn.source.system.service.ITravelNavgaitService;
import cn.source.common.utils.poi.ExcelUtil;
import cn.source.common.core.page.TableDataInfo;

/**
 * 导航管理Controller
 *
 * @author sourcebyte.vip
 * @date 2024-06-18
 */
@RestController
@RequestMapping("/travel/navgait")
public class TravelNavgaitController extends BaseController
{
    @Autowired
    private ITravelNavgaitService travelNavgaitService;

    /**
     * 查询导航管理列表
     */
    @PreAuthorize("@ss.hasPermi('travel:navgait:list')")
    @GetMapping("/list")
    public TableDataInfo list(TravelNavgait travelNavgait)
    {
        startPage();
        List<TravelNavgait> list = travelNavgaitService.selectTravelNavgaitList(travelNavgait);
        return getDataTable(list);
    }

    /**
     * 获取导航管理详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(travelNavgaitService.selectTravelNavgaitById(id));
    }

    /**
     * 新增导航管理
     */
    @PreAuthorize("@ss.hasPermi('travel:navgait:add')")
    @Log(title = "导航管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TravelNavgait travelNavgait)
    {
        return toAjax(travelNavgaitService.insertTravelNavgait(travelNavgait));
    }

    /**
     * 修改导航管理
     */
    @PreAuthorize("@ss.hasPermi('travel:navgait:edit')")
    @Log(title = "导航管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TravelNavgait travelNavgait)
    {
        return toAjax(travelNavgaitService.updateTravelNavgait(travelNavgait));
    }

    /**
     * 删除导航管理
     */
    @PreAuthorize("@ss.hasPermi('travel:navgait:remove')")
    @Log(title = "导航管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(travelNavgaitService.deleteTravelNavgaitByIds(ids));
    }

    /**
     * 导出导航管理列表
     */
    @PreAuthorize("@ss.hasPermi('travel:navgait:export')")
    @Log(title = "导航管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TravelNavgait travelNavgait)
    {
        List<TravelNavgait> list = travelNavgaitService.selectTravelNavgaitList(travelNavgait);
        ExcelUtil<TravelNavgait> util = new ExcelUtil<TravelNavgait>(TravelNavgait.class);
        util.exportExcel(response, list, "导航管理数据");
    }
}
